/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UnitTest;

import junit.framework.TestCase;
import Model.Boletos;
import DB.DBManager;
import DB.Boleto.ControllerBoleto;
import java.sql.SQLException;
import static junit.framework.TestCase.assertEquals;

/**
 *
 * @author KZA
 */
public class TesteBoleto extends TestCase {
    
    DBManager db;
    
    public TesteBoleto(String testName, DBManager db) {
        super(testName);
        this.db = db;
    }

   /* public void testeBoleto(long eventId, long userId) {
        System.out.println("* Unit_Test: I testeBoleto");

        Boleto bole = new Boleto(eventId, userId, "01092013");

        assertEquals(userId,        bole.getIdParticipante());
        assertEquals(eventId,       bole.getIdEvento());
        assertEquals("01092013",    bole.getDataBoleto());
        
        System.out.println("* Unit_Test: F testeBoleto");
    }

    public long testeInsertBoletoBanco(long eventId, long userId) throws SQLException, ClassNotFoundException {
        System.out.println("* Unit_Test: I testeInsertBoletoBanco");
        
        ControllerBoleto ic = ControllerBoleto.getInstance();
        int count = db.getTableCount("Inscricoes");
        Boleto bole = new Boleto(eventId, userId, "01092013");
        long id = ic.insert(bole);

        assertEquals(count+1, db.getTableCount("Inscricoes"));
        
        System.out.println("* Unit_Test: F testeInsertBoletoBanco");
        return id;
    }
    
    public void testeUpdateBoletoBanco(long id, long eventId, long userId) throws SQLException {
        System.out.println("* Unit_Test: I testUpdateBoletoBanco");
        
        ControllerBoleto ic = ControllerBoleto.getInstance();
        int count = db.getTableCount("Inscricoes");
        Boleto bole = new Boleto(eventId, userId, "30092013");
        bole.setId(id);
        long n = ic.update(bole);

        assertEquals(n, 1);
        assertEquals(count, db.getTableCount("Inscricoes"));

        System.out.println("* Unit_Test: F testUpdateBoletoBanco");
    }
    
    public void testeSelectBoletoBanco(long id, long eventId, long userId) throws SQLException {
        System.out.println("* Unit_Test: I testSelectBoletoBanco");

        Boleto bole = new Boleto();
        
        ControllerBoleto ic = ControllerBoleto.getInstance();
        
        bole = ic.getByID(id);
        
        assertEquals(userId,        bole.getIdParticipante());
        assertEquals(eventId,       bole.getIdEvento());
        assertEquals("30092013",    bole.getDataBoleto());
        
        System.out.println("* Unit_Test: F testSelectBoletoBanco");
    }*/
}
